<?php namespace Common\Model;
use Hdphp\Model\Model;
use Common\Model\Cate;


class Content extends Model{
	//指定表名
	protected $table = 'goods';
	
	
	public function getGoodsCate(){
		
		//yi.先获取顶级分类
		$cateModel = new Cate();
		$cate = $cateModel->where("pid=0")->get();
		$sonCate = $cateModel->where("pid != 0")->limit(11)->get();
		//er.把想同的pid放一起
		foreach ($cate as $k => $v) {
			foreach ($sonCate as $kk => $vv) {
				if($vv['pid'] == $v['cid']){
					$cate['value'][$kk]=$sonCate[$kk];
				}
			}
		}
		//san.拿出第二级的分类
		return $cate['value'];		
	}
}
 ?>